#include "widget.h"
#include "ui_widget.h"
#include <QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    this->tch = new Teacher(this);
    this->stu = new Student(this);

    QPushButton * btn = new QPushButton("上课了", this);
    resize(800, 600);

    btn->move(100, 100);

    connect(tch, &Teacher::MySignal, stu, &Student::StartStudy);
    connect(btn, &QPushButton::clicked, tch, &Teacher::MySignal);

    EmitSignal();

    ui->setupUi(this);
}

void Widget::EmitSignal()
{
    emit tch->MySignal();
}

Widget::~Widget()
{
    delete ui;
}
